package com.atguigu.gmallpublisher.service.impl;

import com.atguigu.gmallpublisher.mapper.SugarMapper;
import com.atguigu.gmallpublisher.service.SugarService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;


@Service
public class SugarServicelmpl implements SugarService {
    private SugarMapper sugarMapper;

    @Override
    public Map<String,Integer> getKeyWord(int date, int limit) {
        HashMap<String, Integer> resultMap = new HashMap<>();
        List<Map> mapList = sugarMapper.selectKeyWord( date, limit );
        for (Map map : mapList) {
            resultMap.put( (String) map.get( "keyword" ),(Integer) map.get( "keyword_count" ) );
        }
        return resultMap;
    }
}
